package com.kittlen.managementSystem.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.kittlen.managementSystem.entity.Evaluate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kittlen.managementSystem.entity.Notice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author kittlen
 * @since 2021-02-07
 */
public interface EvaluateMapper extends BaseMapper<Evaluate> {

    @Select("SELECT t_evaluate.* FROM t_evaluate ${ew.customSqlSegment}")
    @ResultMap("com.kittlen.managementSystem.mapper.EvaluateMapper.resultMap")
    List<Evaluate> select(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Insert("insert into t_evaluate (evaluate_id,choice_id,student_id,coach_id,score,evaluate_content,create_date) values (#{evaluate.evaluateId}," +
            "#{evaluate.choice.choiceId},#{evaluate.student.studentId},#{evaluate.coach.coachId},#{evaluate.score},#{evaluate.evaluateContent},now())")
    int insert(@Param("evaluate") Evaluate evaluate);
}
